package com.triones.api.controller.api;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.triones.api.entity.bo.EmailChangeRecordBO;
import com.triones.api.service.EmailChangeRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * api - 邮箱更换记录
 *
 * @Author: triones
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/emailChg")
public class ApiEmailChangeRecordController extends BaseController {

    private final EmailChangeRecordService emailChangeRecordService;

    /**
     * 更换邮箱
     * @param bo
     * @return
     */
    @PostMapping
    @RepeatSubmit
    public R<Void> redirect(@RequestBody EmailChangeRecordBO bo) {
        return toAjax(emailChangeRecordService.redirect(bo));
    }
}
